import { createStackNavigator, createSwitchNavigator } from 'react-navigation';

import Main from './main';
import LoginScreen from './pages/login';
import Base from './pages/base';
import Icon from './pages/icon';
import ButtonScreen from './pages/button';
import InputScreen from './pages/input';
import Web from './pages/web';
import RadioScreen from './pages/radio';
import SwitchScreen from './pages/switch';
import TextareaScreen from './pages/textarea';
import OptionScreen from './pages/option';
import ToastScreen from './pages/toast';
import ModalScreen from './pages/modal';
import ActionSheetScreen from './pages/actionSheet';
import LoadingScreen from './pages/loading';
import CallUs from './pages/callUs';
import Utils from './pages/utilcomponet';
import Origin from './pages/origin';
import MarqueeScreen from './pages/marqueeLable';
import PwdScreen from './pages/password';
import ListScreen from './pages/list';
import PullAndLoadScreen from '../src/pages/pull_load';
import SliderScreen from '../src/pages/slider';
import PanResponder from '../src/pages/panResponder';
import WebViewScreen from '../src/pages/webViewScreen';
import CheckBoxScreen from '../src/pages/checkbox';
import DatePickScreen from '../src/pages/datepick';
import DatePickerScreen from '../src/pages/datepicker';
import PickerViewScreen from '../src/pages/pickerview';
import ModealAntScreen from '../src/pages/modalant';
import TabsAntScreen from '../src/pages/table';
import CarouselAntScreen from '../src/pages/carouselant';

const removeHeader = () => ({
  //需要在 SafeAreaView 手动添加 forceInset={{ top: 'never' }}，将状态栏占位去除
  header: null,
});

const commonNavigationOptions = {
  headerStyle: {
    backgroundColor: '#fff',
  },
  headerTintColor: '#000',
  headerTitleStyle: {
    fontWeight: 'bold',
  },
};

const AppStack = createStackNavigator(
  {
    Main: {
      screen: Main,
      navigationOptions: removeHeader,
    },
    LoginScreen: {
      screen: LoginScreen,
      navigationOptions: removeHeader,
    },
    Base: {
      screen: Base,
      navigationOptions: () => ({
        title: '基础组件',
      }),
    },
    Icon: {
      screen: Icon,
      navigationOptions: () => ({
        title: '公共Icon库',
      }),
    },
    ButtonScreen: {
      screen: ButtonScreen,
      navigationOptions: () => ({
        title: 'Button组件',
      }),
    },
    CheckBoxScreen: {
      screen: CheckBoxScreen,
      navigationOptions: () => ({
        title: 'CheckBox组件',
      }),
    },
    DatePickScreen: {
      screen: DatePickScreen,
      navigationOptions: () => ({
        title: 'DatePick组件',
      }),
    },
    DatePickerScreen: {
      screen: DatePickerScreen,
      navigationOptions: () => ({
        title: 'DatePicker组件',
      }),
    },
    PickerViewScreen: {
      screen: PickerViewScreen,
      navigationOptions: () => ({
        title: 'PickerView组件',
      }),
    },
    ModealAntScreen: {
      screen: ModealAntScreen,
      navigationOptions: () => ({
        title: 'Modeal组件',
      }),
    },
    
    InputScreen: {
      screen: InputScreen,
      navigationOptions: () => ({
        title: 'input组件',
      }),
    },
    RadioScreen: {
      screen: RadioScreen,
      navigationOptions: () => ({
        title: 'Radio组件',
      }),
    },
    SwitchScreen: {
      screen: SwitchScreen,
      navigationOptions: () => ({
        title: 'switch组件',
      }),
    },

    TextareaScreen: {
      screen: TextareaScreen,
      navigationOptions: () => ({
        title: 'textarea组件',
      }),
    },
    OptionScreen: {
      screen: OptionScreen,
      navigationOptions: () => ({
        title: '操作反馈',
      }),
    },
    ToastScreen: {
      screen: ToastScreen,
      navigationOptions: () => ({
        title: 'toast提示',
      }),
    },
    ModalScreen: {
      screen: ModalScreen,
      navigationOptions: () => ({
        title: 'Modal模态框',
      }),
    },
    ActionSheetScreen: {
      screen: ActionSheetScreen,
      navigationOptions: () => ({
        title: 'action-sheet动作面板',
      }),
    },
    LoadingScreen: {
      screen: LoadingScreen,
      navigationOptions: () => ({
        title: 'Loading加载',
      }),
    },
    CallUs: {
      screen: CallUs,
      navigationOptions: () => ({
        title: '联系我们',
      }),
    },
    Utils: {
      screen: Utils,
      navigationOptions: () => ({
        title: '工具组件',
      }),
    },
    Origin: {
      screen: Origin,
      navigationOptions: () => ({
        title: '原生部分',
      }),
    },
    MarqueeScreen: {
      screen: MarqueeScreen,
      navigationOptions: () => ({
        title: '跑马灯',
      }),
    },
    PwdScreen: {
      screen: PwdScreen,
      navigationOptions: () => ({
        title: '安全键盘',
      }),
    },
    ListScreen: {
      screen: ListScreen,
      navigationOptions: () => ({
        title: '列表组件',
      }),
    },

    Web: {
      screen: Web,
      navigationOptions: ({ navigation }) => ({
        title: navigation.getParam('title') || '',
      }),
    },
    WebViewScreen: {
      screen: WebViewScreen,
      navigationOptions: removeHeader,
    },
    

    PullAndLoadScreen: {
      screen: PullAndLoadScreen,
      navigationOptions: () => ({
        title: '下拉刷新上拉加载',
      }),
    },
    SliderScreen: {
      screen: SliderScreen,
      navigationOptions: () => ({
        title: 'Slider组件',
      }),
    },
    PanResponder: {
      screen: PanResponder,
      navigationOptions: () => ({
        title: '手势响应',
      }),
    },
    TabsAntScreen: {
      screen: TabsAntScreen,
      navigationOptions: () => ({
        title: 'Tabs组件',
      }),
    },
    CarouselAntScreen: {
      screen: CarouselAntScreen,
      navigationOptions: () => ({
        title: '轮播组件',
      }),
    },

    
    

    
  },
  {
    initialRouteName: 'Main',
    navigationOptions: commonNavigationOptions,
  },
);

const AuthStack = createStackNavigator(
  {
    Main: {
      screen: Main,
      navigationOptions: removeHeader,
    },
  },
  {
    initialRouteName: 'Main',
  },
);

export default createSwitchNavigator(
  //每次只显示一个screen
  {
    App: AppStack,
    Auth: AuthStack,
  },
  {
    initialRouteName: 'App',
  },
);
